import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("rrz_site_menus", { schema: "rrzcms" })
export class RrzSiteMenus {
  @PrimaryGeneratedColumn({
    type: "int",
    name: "id",
    comment: "ID",
    unsigned: true,
  })
  id: number;

  @Column("varchar", { name: "title", comment: "标题", length: 100 })
  title: string;

  @Column("varchar", { name: "en_title", comment: "英文标题", length: 100 })
  enTitle: string;

  @Column("varchar", {
    name: "dir_name",
    nullable: true,
    comment: "目录英文名",
    length: 255,
  })
  dirName: string | null;

  @Column("int", {
    name: "parent_id",
    comment: "上级菜单",
    unsigned: true,
    default: () => "'0'",
  })
  parentId: number;

  @Column("varchar", { name: "id_path", comment: "id路径", length: 255 })
  idPath: string;

  @Column("tinyint", {
    name: "depth",
    comment: "菜单深度",
    unsigned: true,
    default: () => "'0'",
  })
  depth: number;

  @Column("varchar", {
    name: "url",
    nullable: true,
    comment: "自定义链接",
    length: 200,
  })
  url: string | null;

  @Column("smallint", {
    name: "sort",
    comment: "排序",
    unsigned: true,
    default: () => "'0'",
  })
  sort: number;

  @Column("varchar", { name: "path", comment: "上下级路径", length: 100 })
  path: string;

  @Column("enum", {
    name: "target_blank",
    comment: "是否新开窗口",
    enum: ["true", "false"],
    default: () => "'false'",
  })
  targetBlank: "true" | "false";

  @Column("longtext", { name: "config", nullable: true, comment: "配置" })
  config: string | null;
}
